#include <vector>
#include <iostream>
#include <cmath>

using namespace std;

class Solution {
public:
    int sumFourDivisors(vector<int>& nums) {
        //unordered_map<int, int> div_map;
        int ans = 0;
        for (int num : nums) {
            int cur_total = 0;
            int cur_num = 0;
            int stop_num = sqrt(num);
            for (int i = 1; i < stop_num; i++) {
                if (num % i == 0) {
                    cur_num += 2;
                    cur_total += num / i;
                    cur_total += i;
                    if (cur_num > 4) {
                        break;
                    }
                }
            }
            if (stop_num * stop_num == num) {
                cur_num += 1;
                cur_total += stop_num;
            } else if (num % stop_num == 0) {
                cur_num += 2;
                cur_total += num / stop_num;
                cur_total += stop_num;
            }
            if (cur_num == 4) {
                ans += cur_total;
            }
        }
        return ans;
    }
};

int main() {
    vector<int> input = {1,2,3,4,5,6,7,8,9,10};
    Solution solution;
    int output = solution.sumFourDivisors(input);
    cout << output << endl;
    return 0;
}